1. Field of the Invention
The present invention relates to a data output apparatus for data writing on, and reading from, storage memories, particularly storage memories using storage media like an optical disk.
2. Description of the Prior Art
Heretofore, when such data as video-audio data was to be written on or read from a storage device, the data as requested was sent to or transferred from the storage memories in small segments of a specific size for transfer, 64 kilobytes, for examplexe2x80x94the size specified by OS.
If a writing request for data was made when another data was being read out from the storage device, the reading would change to the writing and the writing to the reading by turns per data size of the data divided into small segments. Therefore, it may causes that the head of the storage device moves to a specific portionxe2x80x94that is called xe2x80x9cseekxe2x80x9dxe2x80x94whenever the mode changes.
The storage device generally comprises a hard disc drive including a hard disc as a storage media. Even if out and on such storage device moving picture data with high-bit rate such as MPEG2 are read and written simultaneously, the duration required to seek (in case of a low performance disk, not longer than 20 m.s.) is shorter as comparing with the duration required to transfer the specific size of data (for example, to transfer a specific size of 256 kilobytes at not more than 40 m.s.). Furthermore, the transfer capacity of the storage device was large fully enough for the bit rate of data. Accordingly there are no problems with that system, and it was not necessary to take into consideration the duration required to seek.
However, that was not the case with the storage memories using an optical disk like DVD as storage medium. Unlike when a hard disk drive was used, the duration required to seek was very long (at about one second) as comparing with the duration required to transfer data. Furthermore, the capability of the storage device using an optical disk is very low in transfer (for example, at 10.08 Mbps., the duration needed to transfer a specific size of 64 kilobyte is 50 m.s.) Therefore, if a request for writing is made when a high bit rate moving picture data such as MPEG 2 is being read out, the total bit rate of the data to read out and the data to write could go up beyond the transfer capacity of the storage device. And since the storage device has to seek each time of switching to reading out and writing, and even if the total bit rate of the data to read out and the data to write is close to the transfer capacity of the storage device, those data could not be transferred real-time on account of the xe2x80x9cseekxe2x80x9d duration needed. The result was that a stream of data like video-audio data would be interrupted in writing or reading data.
The present invention addresses that problem. And it is an object of the present invention to provide a data output apparatus that guarantees real-time in writing and reading of data stream.
To achieve the aforesaid object, the present invention is built on a data output apparatus in which a data stream to input is first written on a recording medium (in FIG. 1, a storage media 2 loaded on a storage device 1) and the data stream recorded on the recording medium is read out and outputted to external device.
The data stream contains video information compressed at a variable bit rate. The data output apparatus is provided with a first buffer 3 that retains the inputted data stream, writing means 4 for writing on the aforesaid recording medium the data stream held in the first buffer 3, second buffer 6 for holding the data stream to output to external device, reading means 7 for reading on to the second buffer 6 the data stream recorded on the recording medium, predicting means 20 (second duration predicting means 9) for predicting the consumption duration W to consume the data stream held on the second buffer 6 on the basis of the duration needed for presentation of video information contained in the data stream held on the second buffer 6xe2x80x94second predicted consumption duration Wxe2x80x94, and writing limiting means 5 or/and reading limiting means 14 for controlling the writing means 4 and reading means 7 as control means 21.
The writing means 4 writes and reading means 7 reads the data stream exclusively on the recording medium. The control means 21 so controls the writing means 4 and reading means 7 on the basis of the second predicted consumption duration W that the second buffer will not underflow.
Furthermore, the control means 21 so controls the writing means 4 and reading means 7 as to keep down the number of switchings between writing and reading the data stream on the recording medium.
Also, the control means 21 controls the writing means 4 and reading means 7 in such a way that in case the second predicted consumption duration W predicted by the predicting means 20 is not lower than a second threshold value T2, a permit will be given for writing of the data stream from the first buffer on the recording medium. The second threshold value T2 is a value defined this way. With the maximum duration needed for writing a specific size of segment of data stream on the recording medium as the first maximum duration Tw and the maximum duration needed for reading a specific size of segment of data stream on to the second buffer as the second maximum duration Tr, a value larger than the second maximum duration Tr shall be called first threshold value T1, and the value obtained by putting the first maximum duration Tw and the second maximum duration Tr together shall be given as second threshold value T2.
In addition, the control means 21 so controls the writing means 4 and reading means 7 that in case second predicted consumption duration W predicted by the predicting means 20 is less than the second threshold value T2, the control means 21 prohibits writing the data stream on the recording medium from the first buffer and permits writing the data stream on the second buffer from the recording medium.
There is also provided a memory retaining a time table on which the offset values b01, b02, . . . , b0n of the data stream are linked or related to the times a01, a01, . . . , a0n required for the offset values b01, b02, . . . , b0n of the data stream to be reproduced. And the predicting means 20 measures the amount of data sent out from the second buffer and the amount of data inputted into the second buffer. On the basis of the amount of data sent out and the amount of data inputted, a calculation is made to find the initial offset value b0i and the last offset value b0j of the data stream retained in the second buffer. Then, reference is made to the time table to acquire the time a0i for the offset value b0i and the time a0j for the offset value b0j. And the second predicted consumption duration, that is, a0j-a0i is worked out.
It is also possible to work out the second predicted consumption duration a1j-a1i under the following arrangement provided with a memory having a time table on which the durations xe2x80x9ca11-0,xe2x80x9d xe2x80x9ca12-a11,xe2x80x9d xe2x80x9ca13-a12,xe2x80x9d . . . xe2x80x9ca1n-a1(nxe2x88x921)xe2x80x9d are linked to the bit rates r11, r12, r13 . . . , r1n of the data stream at the respective durations. Under that arrangement, the predicting means 20 measures the amount of data sent out from the second buffer and the amount of data inputted to the second buffer. On the basis of the amount of data sent out and the amount of data inputted, a calculation is made to find the initial offset value a1i and the last offset value a1j of the data stream held in the second buffer. Thus, the second predicted consumption duration a1j-a1i is worked out.
Furthermore, in case the data stream is a data stream of the MPEG formula, the predicting means 20 acquires the time code to be used for reproduction that is included in the data stream of the MPEG formula held on the second buffer. On the basis of the time code, the second predicted consumption duration can be found.
The time code may be the system clock reference in the pack header provided at the head of each of the packs that form program stream of the MPEG formula or the program clock reference in the adaptation field of each of the transport packets forming the transport stream of the MPEG formula.
Further, in case the data stream is a data stream in which bit rate information of data stream block at the time of reproduction is recorded at the information field provided at the head of the respective blocks of data stream, the predicting means 20 acquires bit rate information at the time of reproduction in the respective blocks of the data stream held on the second buffer and the respective block size. And on the basis of the bit rate information and the block size, predicting means 20 works out the second predicted consumption duration.
The foregoing examples work under the condition that the send rate of the second buffer 6 is identical with the bit rate of the data stream. In case the data output unit is connected to a unit for reproduction of data to be outputted from the data output unit and to a reproduction buffer 12 that temporarily holds data sent out to the aforesaid reproduction unit, the send rate of the second buffer 6 is no longer the same as the bit rate of the data stream. With consideration given to such a case, the following arrangement is also possible for prediction of the second predicted consumption duration. That is, send rate detection means 13 detects the amount of data sent out per unit period from the second buffer. And the predicting means 20 works out the second predicted consumption duration on the basis of the history of the amount of data sent out per unit period from the second buffer and the history of the time required for presentation of video information contained in the data stream held in the second buffer.